package org.solr.test;

import java.io.FileInputStream;
import java.io.IOException;

import javax.xml.parsers.ParserConfigurationException;

import org.apache.lucene.index.MergePolicy;
import org.apache.solr.client.solrj.embedded.EmbeddedSolrServer;
import org.apache.solr.core.CoreContainer;
import org.apache.solr.core.SolrConfig;
import org.apache.solr.schema.IndexSchema;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;

public class testMergePolicy {
	String mpClassName = "org.apache.lucene.index.NoMergePolicy";

	public void test(IndexSchema schema) {

		MergePolicy policy = schema.getResourceLoader().newInstance(mpClassName, MergePolicy.class);
	}
	
	public void query(){
		System.setProperty("solr.solr.home","g:/example/solr");
		CoreContainer.Initializer initializer = new CoreContainer.Initializer();
		CoreContainer coreContainer = initializer.initialize();
		EmbeddedSolrServer solrServer = new EmbeddedSolrServer(coreContainer,"");
	}

	public static void main(String[] args) throws ParserConfigurationException, IOException, SAXException {
		System.setProperty("solr.solr.home","G:\\example\\solr"); 
		//load config
		SolrConfig solrConfig = new SolrConfig("G:\\example\\solr\\collection1\\conf\\solrconfig.xml");
		InputSource is = new InputSource(new FileInputStream("G:\\example\\solr\\collection1\\conf\\schema.xml"));
		
		IndexSchema indexSchema = new IndexSchema(solrConfig,"solrconfig",is); 
		testMergePolicy tm = new testMergePolicy();
		tm.test(indexSchema);

	}
}
